import Vue from 'vue'
import VueRouter from "vue-router";
import item from "@/components/item.vue";
import MainPage from "@/components/MainPage.vue";
import Login from "@/components/Login.vue";
import person from "@/components/person/person.vue"
import personMessage from "@/components/person/personMessage.vue";
import cartList from "@/components/cart/cartList";
import payment from "@/components/cart/payment";
import checkOut from "@/components/cart/checkOut";
import addresses from "@/components/cart/addresses";
import deleteAddress from "@/components/cart/deleteAddress";
import product from "@/components/product.vue";
import order from "@/components/order/order";


//把VueRouter安装为Vue项目的插件
Vue.use(VueRouter)

//创建路由的实例对象
const router = new VueRouter({
    mode: 'history',
    routes: [
        {
            path: "",
            name: 'MainPage',
            component: MainPage
        },
        {
            path: "/item",
            name: "item",
            component: item
        },
        {
            path: "/login",
            name: "login",
            component: Login
        },
        {
            path: "/person",
            name: "person",
            component: person,
            children: [{
                path: "/person/personMessage",
                name: "personMessage",
                component: personMessage
            },
                {
                    path: "/person/order",
                    name: "order",
                    component: order
                }
            ]
        },
        {
            path: "/product",
            name: "product",
            component: product
        },
        {
            path: "/cartList",
            name: "cartList",
            component: cartList,
        },
        {
            path: "/payment",
            name: "payment",
            component: payment
        },
        {
            path: "/checkOut",
            name: "checkOut",
            component: checkOut
        },
        {
            path: "/address",
            name: "address",
            component: addresses
        },
        {
            path: "/deleteAddress",
            name: "deleteAddress",
            component: deleteAddress
        },
    ]
});

export default router
